#include<iostream>
#include<fstream>
#include<string>
#include<unordered_map>
#include<utility>

const std::string defaultfilepath="./";
const std::string defaultfilename="dictionary.txt";
class dictionary
{
private:
    void spriltstring(std::string&string)
    {
        std::string key;
        std::string value;
        size_t pos=string.find(':');
        key=string.substr(0,pos);
        value=string.substr(pos+1);
        _dictionary.insert(std::make_pair(key,value));
    }
    void LoadDictionary()
    {
        std::ifstream in;
        in.open(file);
        std::string line;
        while(std::getline(in,line))
        {
            spriltstring(line);
        }
        in.close();                      
    }
    void debug()
    {
        for(auto &e:_dictionary)
        {
            std::cout<<e.first<<":"<<e.second<<std::endl;
        }
    }
public:
    dictionary(const std::string&filepath=defaultfilepath,const std::string&filename=defaultfilename){
        file=defaultfilepath;
        file+=defaultfilename;
        LoadDictionary();
        debug();
    }
    std::string translate(const std::string&word)
    {
        auto pos=_dictionary.find(word);
        if(pos==_dictionary.end())
        {
            return "None";
        }
        return pos->second;
    }
    ~dictionary(){

    }

private:
    std::string file;
    std::unordered_map<std::string,std::string> _dictionary;
};